#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
#include<queue>
#include<stack>
#include <functional>
#include <memory>
using namespace std;

class Solution {
public:
    int maxProduct(vector<int>& nums) {
        int n = nums.size();
        vector<int> f(n + 1);
        auto g = f;
        g[0] = f[0] = 1;
        int ret = -0xffffff;
        for (int i = 1; i <= n; i++)
        {
            int x = nums[i - 1];
            f[i] = max(max(x, f[i - 1] * x), x * g[i - 1]);
            ret = max(ret, f[i]);
            g[i] = min(min(x, g[i - 1] * x), f[i - 1] * x);
        }
        return ret;
    }
};

int main()
{
    vector<int> in(30, -1);
	return 0;
}